Back to course home
0% completed
Vote For New Content
Google Hard
Shortest Subarray with Sum at Least K (hard)
Solution: Shortest Subarray with Sum at Least K
Reverse Pairs (hard)
Solution: Reverse Pairs
Nth Magical Number (hard)
Solution: Nth Magical Number
Candy (hard)
Solution: Candy
Arithmetic Slices II - Subsequence (hard)
Solution: Arithmetic Slices II - Subsequence
Burst Balloons (hard)
Solution: Burst Balloons
Sum of Distances in Tree (hard)
Solution: Sum of Distances in Tree
Maximum Score of a Good Subarray (hard)
Solution: Maximum Score of a Good Subarray
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Letter Combinations of a Phone Number (medium)
Problem Statement
Given a string digits containing digits from 2-9, return an array of strings containing all possible letter combinations that the number could represent. You may return the answer in any order.
The mapping of digits to letters (just like on the telephone buttons) is as given below.
1-> It doesn't map any number.2-> "abc"3-> "def"4-> "ghi"5-> "jkl"6-> "mno"7-> "pqrs"8-> "tuv"9-> "wxyz"
Examples
-
Example 1:
- Input: digits =
"47" - Expected Output:
["gp", "gq", "gr", "gs", "hp", "hq", "hr", "hs", "ip", "iq", "ir", "is"] - Justification: The digit '4' maps to "ghi", and '7' maps to "pqrs". Combining these letters in every possible way gives us the expected output.
- Input: digits =
-
Example 2:
- Input: digits =
"29" - Expected Output:
["aw", "ax", "ay", "az", "bw", "bx", "by", "bz", "cw", "cx", "cy", "cz"] - Justification: The digit '2' maps to "abc", and '9' maps to "wxyz". The combinations of these letters result in the expected output.
- Input: digits =
-
Example 3:
- Input: digits =
"7" - Expected Output:
["p", "q", "r", "s"] - Justification: The digit '7' maps to "pqrs". All possible combinations of these letters are reflected in the expected output.
- Input: digits =
Constraints:
- 0 <= digits.length <= 4
- digits[i] is a digit in the range ['2', '9'].
Try it yourself
Try solving this question here:
Java
Saved to Cloud
. . . .
Solution: Minimum Difference Between Largest and Smallest Value in Three Moves
Solution: Letter Combinations of a Phone Number
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself